package com.ruoyi.project.business.publicholiday.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.business.publicholiday.response.HolidayResponse;
import com.ruoyi.project.business.publicholiday.service.IHolidayService;
import com.ruoyi.project.business.utils.BusinessUtil;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class PublicHolidayServiceImpl implements IHolidayService {

    @Override
    public HolidayResponse listOfMonth(Date yearMonth) {
        Integer year = DateUtils.year(yearMonth);
        Integer month = DateUtils.month(yearMonth);
        List<Integer> weekendDayIndexes = DateUtils.getPublicHolidayIndexes(year, month);
        HolidayResponse response = new HolidayResponse();
        response.setWeekends(weekendDayIndexes);
        return response;
    }
}
